import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:school_safe_teacher/resourse/app_colors.dart';
import 'package:school_safe_teacher/widget/my_widget.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    LeaveApprovalState state, Dispatch dispatch, ViewService viewService) {
  return stateBar(
    child: Container(
      color: AppColors.MainBackColor,
      child: Stack(
        children: [
          Container(
            child: Image.asset("images/yellow_bg@2x.png"),
          ),
          Container(
            margin: EdgeInsets.only(
                top: MediaQuery.of(viewService.context).padding.top),
            child: myBar(context: viewService.context, title: "请假审批"),

          ),
          Container(
            padding: EdgeInsets.only(
                top: MediaQuery.of(viewService.context).padding.top +
                    kMinInteractiveDimension),
            child: ListView.builder(
              padding: EdgeInsets.zero,
              itemBuilder: (BuildContext context, int index) {
                return Container(
                  padding: EdgeInsets.all(15),
                  margin:
                      EdgeInsets.only(top: 5, left: 15, right: 15, bottom: 5),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.elliptical(10, 10)),
                    color: Colors.white,
                  ),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: [
                      Container(
                        child: Row(
                          children: [
                            Image.asset(
                              "images/leave_people@2x.png",
                              width: 12,
                              height: 12,
                            ),
                            Container(
                                margin: EdgeInsets.only(left: 5),
                                child: Text(
                                  "申请人  白伟琪",
                                  style: TextStyle(
                                      color: AppColors.deepTextColor,
                                      fontSize: 15),
                                )),
                            Expanded(child: SizedBox()),
                            Container(
                              child: Text("查看详情",
                                  style: TextStyle(
                                      color: AppColors.smallTextColor,
                                      fontSize: 12)),
                            )
                          ],
                        ),
                      ),
                      Divider(
                        height: 20,
                        color: AppColors.MainBackColor,
                      ),
                      Stack(
                        children: [
                          Container(
                            margin: EdgeInsets.only(top: 5),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.start,
                              crossAxisAlignment: CrossAxisAlignment.stretch,
                              children: [
                                Container(
                                  child: Text(
                                    "请假类别  病假",
                                    style: TextStyle(
                                        color: AppColors.deepTextColor,
                                        fontSize: 14),
                                  ),
                                ),
                                Container(
                                  margin: EdgeInsets.only(top: 10),
                                  child: Text(
                                    "请假时间  2020-05-02 - 2020-05-03",
                                    style: TextStyle(
                                        color: AppColors.deepTextColor,
                                        fontSize: 14),
                                  ),
                                ),
                              ],
                            ),
                          ),
                          Positioned(
                            top: 0,
                            bottom: 0,
                            right: 0,
                            child: Image.asset(
                              "images/leave_failed@2x.png",
                              width: 50,
                              height: 50,
                            ),
                          )
                        ],
                      )
                    ],
                  ),
                );
              },
              itemCount: 2,
            ),
          ),
        ],
      ),
    ),
    context: viewService.context,
  );
}
